using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using Voodoo.Sauce.Internal.GDPR;
using Voodoo.Sauce.Internal.GDPR.UI;

public class VoodooGDPRPrivacyScreen : MonoBehaviour
{
	[SerializeField]
	private SimpleCheckbox[] _checkboxesRequiredForPlaying;

	[SerializeField]
	private SimpleCheckbox[] _checkboxesRequiredForLearnMore;

	[SerializeField]
	private SimpleCheckbox[] _checkboxesRequiredForPlayingWithoutAdTracking;

	[SerializeField]
	private Button _playBtn;

	[SerializeField]
	private Button _learnMoreBtn;

	private void Start()
	{
		SimpleCheckbox[] checkboxesRequiredForLearnMore = _checkboxesRequiredForLearnMore;
		foreach (SimpleCheckbox simpleCheckbox in checkboxesRequiredForLearnMore)
		{
			simpleCheckbox.OnToggle.AddListener(delegate
			{
				UpdateButtonsAvailability();
			});
		}
		SimpleCheckbox[] checkboxesRequiredForPlaying = _checkboxesRequiredForPlaying;
		foreach (SimpleCheckbox simpleCheckbox2 in checkboxesRequiredForPlaying)
		{
			simpleCheckbox2.OnToggle.AddListener(delegate
			{
				UpdateButtonsAvailability();
			});
		}
		UpdateButtonsAvailability();
	}

	private void UpdateButtonsAvailability()
	{
		if (VoodooGDPR.HasLimitAdTrackingEnabled())
		{
			_playBtn.interactable = _checkboxesRequiredForPlayingWithoutAdTracking.All((SimpleCheckbox box) => box.IsChecked());
			return;
		}
		_playBtn.interactable = _checkboxesRequiredForPlaying.All((SimpleCheckbox box) => box.IsChecked());
		_learnMoreBtn.interactable = _checkboxesRequiredForLearnMore.All((SimpleCheckbox box) => box.IsChecked());
	}
}
